package cn.cjj.gulimall.ware.dao;

import cn.cjj.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author cjj
 * @email cjj@gmail.com
 * @date 2021-05-28 11:11:01
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Long skuNum);


    Long getSkuStock(@Param("skuId") Long skuId);

    List<Long> listWareIdsHasSkuStock(@Param("skuId") Long skuId);

    long lockSkuStock(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("count") Integer count);


    void unLockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);
}
